package com.ruoyi.reserve.service.impl;

import com.ruoyi.reserve.domain.Checkitem;
import com.ruoyi.reserve.mapper.CheckitemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CheckItemsServiceImpl implements ICheckItemsService {

    @Autowired
    private CheckitemMapper checkitemMapper;

    @Override
    public List<Checkitem> getList(Checkitem checkitem) {
        return checkitemMapper.selectPostList(checkitem);
    }

    @Override
    @Transactional
    public int deleteItemsByIds(Integer[] itemsId) {
        return checkitemMapper.deleteItemsByIds(itemsId);
    }

    /**
     * 新增保存岗位信息
     *
     * @param checkitem 岗位信息
     * @return 结果
     */
    @Override
    @Transactional
    public int insertItems(Checkitem checkitem) {
        return checkitemMapper.insertItems(checkitem);
    }

    /**
     * 根据id获取该条检查项的详情
     * @param id
     * @return
     */
    @Override
    public Checkitem getInfo(Integer id) {
        return checkitemMapper.getInfo(id);
    }

    /**
     * 更新检查项
     */
    @Override
    @Transactional
    public int updateItems(Checkitem checkitem) {
        return checkitemMapper.updateItems(checkitem);
    }

    /**
     * 新增时 根据编号查询检查项是否存在
     * @param code
     * @return
     */
    @Override
    public Checkitem getInfoByCode(String code) {
        return checkitemMapper.getInfoByCode(code);
    }

    /**
     * 新增时 根据名称查询检查项是否存在
     * @param name
     * @return
     */
    @Override
    public Checkitem getInfoByName(String name) {
        return checkitemMapper.getInfoByName(name);
    }


}
